package azk.ml.hw1;

import java.io.File;
import java.util.Random;

import weka.classifiers.Evaluation;
import weka.classifiers.trees.AugmentedJ48;
import weka.classifiers.trees.J48;
import weka.classifiers.trees.j48.C45MeetsKNN;
import weka.classifiers.lazy.IBk;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ArffLoader;



public class ML_HW1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
	    ArffLoader loader = new ArffLoader();	    
	    loader.setFile(new File(args[0]));
	    loader.getStructure();
		Instances instances = loader.getDataSet();
	    instances.setClassIndex(instances.numAttributes()-1);
	   // System.out.println("Num of attributes" + instances.numAttributes());
	    AugmentedJ48 aj = new AugmentedJ48();
	    J48 j = new J48();

	    Evaluation eval = new Evaluation(instances);

	    try {
	    	eval.crossValidateModel(aj, instances, 10, new Random(1));
	    	System.out.println(eval.pctCorrect());
	    }
	    catch (Exception e)
	    {
	    	System.out.println("Shiiiit: " + e.toString());
	    	e.printStackTrace();
	    }
	     
	    		
	}

}
